// ============================== 导入依赖 ============================== //

import DETAIL_API from '@admin/components/detail/DetailRepair/store/API'

// ============================== 导出异步调用 ============================== //

export default {
  // —————————————————————————————— 改 —————————————————————————————— //

  async remoteEdit({ state: { one } }) {
    // 重新查询单项，补全文件列表等信息
    const obj = await DETAIL_API.getOne(one)

    const status = one.resolverUserId ? 'task_receive' : 'task_assign'
    const msg = await DETAIL_API.edit({ ...obj, status }, '工单发布')
    return msg
  },

  // —————————————————————————————— 删 —————————————————————————————— //

  async remoteDel({ state: { one } }) {
    const msg = await DETAIL_API.del(one)
    return msg
  },
}
